<%--
  Created by IntelliJ IDEA.
  User: lushengjie
  Date: 2021/9/24
  Time: 20:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>上传附件</title>
    <link rel="icon" href="/hire/imgs/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="/hire/css/resume/resume_upload.css">
    <link rel="stylesheet" href="/hire/plugins/layui/css/layui.css">

</head>
<body>

<hr>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
    <legend>简历上传</legend>
</fieldset>

<div class="layui-upload-drag" id="test10">
    <i class="layui-icon"></i>
    <p class="upload">点击上传，或将文件拖拽到此处</p>
    <p class="suggest">简历建议使用 PDF 文件，也支持DOC、DOCX、JPG、PNG 格式</p>
    <span>文件大小不超过8M</span>

    <div class="layui-hide" id="uploadDemoView">
        <hr>
        <img src="" alt="上传成功后渲染" style="max-width: 196px">
    </div>
</div>

<script src="/hire/plugins/layui/layui.js"></script>

<script>
    function add() {
        layer.load(0)
    }


    layui.use(['upload', 'element', 'layer'], function () {
        var $ = layui.jquery
            , upload = layui.upload
            , element = layui.element
            , layer = layui.layer;

        //拖拽上传
        upload.render({
            elem: '#test10'
            , url: 'https://httpbin.org/post' //此处用的是第三方的 http 请求演示，实际使用时改成您自己的上传接口即可。
            , done: function (res) {
                layer.msg('上传成功');
                layui.$('#uploadDemoView').removeClass('layui-hide').find('img').attr('src', res.files.file);
                console.log(res)
            }
            ,accept: 'video' //允许上传的文件类型
            ,size: 100000 //最大允许上传的文件大小
        });
    });
</script>
</body>
</html>
